/**
 * @summary 评论列表模块
 */

import req from '@/utils/request';
import * as URL from '@/constants/api';
import { values } from 'lodash';

// 评论列表
export function getCommentsList(id) {
  return req({
    url: URL.COMMENTS_LIST,
    params: {
      type: 'a',
      source: id,
    },
  })
    .then(res => res.data.data)
    .catch(() => []);
}

// 评论

export function articleComments(id, value) {
  return req({
    url: URL.COMMENTS_LIST,
    method: 'post',
    data: {
      target: id,
      content: value,
    }
  })
    .then(res => res.data.message)
    .catch(err => Promise.reject(err.response.data.message))
}
